package com.sangfor.ssl.l3vpn.service.networkInfo;

import androidx.core.os.EnvironmentCompat;

/* loaded from: classes2.dex */
public class PacketInfo {
    public String domain;
    public String host;
    public boolean isValid;
    public int port;
    public int proto;
    public String protoStr;
    public String srcHost;
    public int srcPort;
    public int uid;

    public PacketInfo(String str, String str2, int i, int i2, int i3, String str3, int i4) {
        this.domain = str;
        this.host = str2;
        this.port = i;
        this.uid = i2;
        this.proto = i3;
        this.srcHost = str3;
        this.srcPort = i4;
        this.isValid = true;
        if (i3 == 0) {
            this.protoStr = "TCP";
        } else if (i3 == 1) {
            this.protoStr = "UDP";
        } else if (i3 == 2) {
            this.protoStr = "ICMP";
        } else {
            this.protoStr = EnvironmentCompat.MEDIA_UNKNOWN;
            this.isValid = false;
        }
    }

    public String format() {
        if (this.isValid) {
            return String.format("%s %s:%d", this.protoStr, this.domain, Integer.valueOf(this.port));
        }
        throw new IllegalArgumentException("error, invalid arugment.");
    }

    public String toString() {
        return String.format("srchost is %s, srcport is %d, deshost is %s(%s), desport is %d, uid is %d, proto is %d = %s", this.srcHost, Integer.valueOf(this.srcPort), this.domain, this.host, Integer.valueOf(this.port), Integer.valueOf(this.uid), Integer.valueOf(this.proto), this.protoStr);
    }
}
